<?php
// +----------------------------------------------------------------------
// | Author: yaoyihong <510974211@qq.com>
// +----------------------------------------------------------------------
namespace addon\wechat_config\logic;
use app\common\logic\LogicBase;
use \tpfcore\Core;
use think\Session;
use think\Request;

class User extends LogicBase
{
	public function getUser($data=[]){
		return self::getList($data);
	}
	public function addUser($data){
		$validate=Core::addonValidate($this->name);
        $validate_result = $validate->scene('add')->check($data);
        if (!$validate_result) {
            return [RESULT_ERROR, $validate->getError(), null];
        }

        $result = Core::loadAddonModel($this->name)->saveObject($data,["username","password","integral","money","create_time","last_login_ip","nickname"]);

        if($result){
        	return [RESULT_SUCCESS,"操作成功",url('ucenter/Manager/index')];
        }
        return [RESULT_ERROR,"操作失败",url('ucenter/Manager/index')];
	}

}